package io.renren;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@Slf4j
@SpringBootApplication
@MapperScan("io.renren.dao")
public class RenrenGeneratorApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext configurableApplicationContext = SpringApplication.run(RenrenGeneratorApplication.class, args);
        ConfigurableEnvironment environment = configurableApplicationContext.getEnvironment();
        log.info("\n----------------------------------------------------------\n\t"
                        + "应用 '{}' 运行成功! 访问连接:\n\t" + "地址: \t\thttp://{}:{}\r\n" + "\n"
                        + "\t------处理的持久层是：{}\n"
                        + "----------------------------------------------------------\n\t",
                environment.getProperty("spring.application.name"),
                InetAddress.getLocalHost().getHostAddress(), environment.getProperty("server.port")
                , environment.getProperty("renren.database"));
    }
}
